package com.klikmee.sms.core.base.communicator.starion;

import java.util.Hashtable;

import org.apache.commons.httpclient.NameValuePair;

/**
 * Version of Starion bulk sender that creates query string from fixed number of
 * parameters
 * 
 * @author makcro
 * 
 */
public class FixedParamsBulkSenderImpl extends StarionBulkSenderImpl {

	@Override
	public NameValuePair[] createQueryStringParams(Hashtable<BulkParams, Object> params) {
		// create array for 5 bulk params
		NameValuePair[] result = new NameValuePair[6];
		// extract params and create array elemtns
		result[0] = new NameValuePair( StarionHttpParamNames.SOURCE.toString(), params.get( BulkParams.SENDER ).toString() );
		result[1] = new NameValuePair( StarionHttpParamNames.DEST.toString(), params.get( BulkParams.RECEIVERS ).toString() );
		result[2] = new NameValuePair( StarionHttpParamNames.MESSAGE.toString(), params.get( BulkParams.TEXT ).toString() );
		result[3] = new NameValuePair( StarionHttpParamNames.SEQ.toString(), params.get( BulkParams.SEQ_ID ).toString() );
		result[4] = new NameValuePair( StarionHttpParamNames.USERNAME.toString(), params.get( BulkParams.USERNAME ).toString() );
		result[5] = new NameValuePair( StarionHttpParamNames.DELIVERYREPORT.toString(), params.get( BulkParams.REQUEST_DELIVERY_REPORT ).toString() );

		return result;
	}
}
